import org.junit.Assert;
import org.junit.Test;

public class NGuessNumberTest {
    @Test
    public void generateAnswerTest(){
        int[] sz = NGuessNumber.generateAnswer();
        Assert.assertEquals("不为4",4, sz.length);
        Assert.assertTrue("有重复值",sz[0]!=sz[1] && sz[1]!=sz[2] && sz[2]!=sz[3]);
        Assert.assertTrue("范围不在0~9之间",sz[0]>=0 && sz[0]<=9);
        Assert.assertTrue("范围不在0~9之间",sz[1]>=0 && sz[1]<=9);
        Assert.assertTrue("范围不在0~9之间",sz[2]>=0 && sz[2]<=9);
        Assert.assertTrue("范围不在0~9之间",sz[3]>=0 && sz[3]<=9);
    }
    @Test
    public void getPlayerInputTest(){
        int[] a = NGuessNumber.getPlayerInput();
        Assert.assertEquals("数量不是4位",4, a.length);
    }
    @Test
    public void compareGuessAnswer(){
        int [] daan = {5,2,7,9};
        int [] shuru = {1,2,5,6};
        int[] a = NGuessNumber.compareGuessAnswer(daan, shuru);
        Assert.assertEquals(1,a[0]);
        Assert.assertEquals(0,a[1]);
    }
    @Test
    public void isWin(){
        int [] a = {2,4};
        Assert.assertFalse("1",NGuessNumber.isWin(a));
    }

}